var preg = /^[a-zA-Z0-9]{8,16}$/;
var s1 = false;
var s2 = false;
$('#pass_pass').parent().parent().submit(function(){
	if(s1 && s2){
		return true;
	}
	return false;
})

$('#pass_pass>input').focus(function(){
	$('#pass_pass').next().find('span').html('<font size="2" color="#d1d1d1">请输入8-16位以字母、数字、下划线的组合</font>');
})

$('#pass_pass>input').blur(function(){
	if(preg.test($(this).val())){
		$('#pass_pass').next().find('span').html('<font size="2" color="#43CD80" title="密码符合规则"><span class="glyphicon glyphicon-ok" aria-hidden="true"></span></font>');
		s1 = true;
	}else{
		$('#pass_pass').next().find('span').html('<font size="2" color="#CD5556" title="密码不符合规则"><span class="glyphicon glyphicon-remove" aria-hidden="true"></span></font>');
		s1 = false;
	}
})

$('#pass_repass>input').focus(function(){
	$('#pass_repass').next().find('span').html('<font size="2" color="#d1d1d1">请与上面填写的密码保持一致</font>');
})

$('#pass_repass>input').blur(function(){
	if(preg.test($(this).val())){
		$('#pass_repass').next().find('span').html('<font size="2" color="#43CD80" title="密码符合规则"><span class="glyphicon glyphicon-ok" aria-hidden="true"></span></font>');
		
		if($(this).val() == $('#pass_pass>input').val()){
			$('#pass_repass').next().find('span').html('<font size="2" color="#43CD80" title="密码一致"><span class="glyphicon glyphicon-ok" aria-hidden="true"></span></font>');
			s2 = true;
		}else{
			$('#pass_repass').next().find('span').html('<font size="2" color="#CD5556" title="密码不一致"><span class="glyphicon glyphicon-remove" aria-hidden="true"></span></font>');
			s2 = false;
		}
	}else{
		$('#pass_repass').next().find('span').html('<font size="2" color="#CD5556" title="密码不符合规则"><span class="glyphicon glyphicon-remove" aria-hidden="true"></span></font>');
		s2 = false;
	}
})

